package demo08;

import java.util.ArrayList;
import java.util.Random;

public class Memeber extends User {
    public Memeber(String name, int money) {
        super(name,money);
    }
    public Memeber() {
        super();
    }

    public void receive(ArrayList<Integer> list){
        int index = new Random().nextInt(list.size());
        //根据索引，从集合中删除红包
        Integer delta = list.remove(index);
        //设置为当前的钱
        this.setMoney(super.getMoney()+delta);
    }
}
